
bool isPalindrome(int x)
{
    int temp = x;
    long reverse = 0;
    // 负数不成立
    if (x < 0)
    {
        return false;
    }

    while (temp > 0)
    {
        reverse = reverse * 10 + temp % 10;
        temp = temp / 10;
    }

    if (reverse == x)
    {
        return true;
    }
    else
    {
        return false;
    }
}
